package cn.edu.neusoft.yyd208.foodorder.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;



public abstract class CommentBaseAdapter<T> extends RecyclerView.Adapter{
    Context context;
    List<T> items;
    String items1;
    int layoutResource;
public CommentBaseAdapter(Context context, String items1, int layoutResource){
    this.context = context;
    this.items1 = items1;
    this.layoutResource = layoutResource;
}
    public CommentBaseAdapter(Context context, List<T> items, int layoutResource) {
        this.context = context;
        this.items = items;
        this.layoutResource = layoutResource;
    }
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView= LayoutInflater.from(context)
                .inflate(layoutResource,parent,false);
        CommentViewHolder myViewHolder=new CommentViewHolder(itemView);

        return myViewHolder;
    }
    @Override
    public int getItemCount() {
        if(items==null)
            return 0;
        else {
            return items.size();
        }

    }
}
